<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>微店优惠券礼包配置列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<link href="cxcalendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script language="javascript" src="../script/Calendar-new.js"></script>
<script type="text/javascript">
$(function(){
	//删除优惠券节点
    $('.delcoupon').live("click",function(){
        $(this).parent().parent().remove();
     });
	
});

//添加优惠券
function _addcoupon(){
    $('.coupons_box').append('<tr><td><input type="text" name="new_cpns_if[]" class="text"  value="" /></td><td><input type="text" name="new_cpns_then[]" class="text" value="" /> </td><td><input type="text" name="new_cpns_num[]" class="text" value="1" /> </td><td><input type="text" name="new_overtime[]" class="text" value="" /> </td><td><img class="delcoupon" src="../image/admin/delete.png"></td></tr>');
}
</script>
<style>
.delcoupon{cursor:pointer;}
</style>
</head>
<body>
<div class="container">
    <div class="flow">
        <div class="itemtitle">
            <h3><{if $smarty.get.act=='add'}>添加<{else}>编辑<{/if}>礼包配置</h3>
            <ul>
                <li><a href="?m=micro_shop&s=coupons_package_config_list.php"><span>礼包配置列表</span></a></li>
            </ul>
        </div>
    </div>
    <div class="h35"></div>
    
	<form name="form" method="post">
	<input type="hidden" name="m" value="<{$smarty.get.m}>">
    <input type="hidden" name="s" value="<{$smarty.get.s}>">
    <input name="id" type="hidden" id="id" value="<{$de.id}>">
    <table class="table">
        <thead>
            <tr>
                <th class="partition" colspan="99">礼包配置</th>
            </tr>
        </thead>
        <tbody>
        <tr>
            <td width="100">名称</td>
            <td>
            <input name="name" id="name" type="text" class="w350" value="<{$de.name}>"><div id="form-error" class="form-error"><{$error}></div>
            </td>
        </tr>
        
        <tr>
            <td>优惠券</td>
            <td width="300" height="300">
	           <div>
				    <table>
				        <thead>
				        <tr>
				            <td>满</td>
				            <td>减</td>
				            <td>数量(张)</td>
				            <td>有效期(天)</td>
				            <td><a href="javascript:void(0);" onclick="_addcoupon();" ><img src="../image/admin/addchildboard.png"></a></td>
				        </tr> 
				        </thead>
				        <tbody class="coupons_box">
				        <{foreach item=floor from=$de.coupons}>
				        <tr>
				            <td><input type="text" name="cpns_if[<{$floor.id}>]" class="text"  value="<{$floor.cpns_if}>" /></td>
				            <td><input type="text" name="cpns_then[<{$floor.id}>]" class="text" value="<{$floor.cpns_then}>" /> </td>
				            <td><input type="text" name="cpns_num[<{$floor.id}>]" class="text" value="<{$floor.cpns_num}>" /> </td>
				            <td><input type="text" name="overtime[<{$floor.id}>]" class="text" value="<{$floor.overtime}>" /> </td>
				            <td><img class="delcoupon" src="../image/admin/delete.png"></td>
				        </tr>
				        <{foreachelse}>
				        <tr>
				            <td><input type="text" name="new_cpns_if[]" class="text"  value="" /></td>
				            <td><input type="text" name="new_cpns_then[]" class="text" value="" /> </td>
				            <td><input type="text" name="new_cpns_num[]" class="text" value="1" /> </td>
				            <td><input type="text" name="new_overtime[]" class="text" value="" /> </td>
				            <td><img class="delcoupon" src="../image/admin/delete.png"></td>
				        </tr>
				        <{/foreach}>
				        </tbody>
				    </table>
			    </div>
            </td>
        </tr>
        
        <tr>
            <td>状态</td>
            <td>
            <input type="radio" name="status" value="1" id="open" <{if $de.status==1}>checked="checked"<{/if}>/><label for="open">开启</label>
            <input type="radio" name="status" value="0" id="close" <{if $de.status==0}>checked="checked"<{/if}>/><label for="close">禁用</label>
            </td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>
            <input class="submit" type="submit" value="提交">
            <input name="act" type="hidden" value="<{if !$de.id}>save<{else}>edit<{/if}>">
            </td>
        </tr>
        </tbody>
    </table>
    </form>
</div>
</body>
</html>